class Solution {
public:
    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
        vector<int> v;
        for (int i = 0; i < timeSeries.size() - 1; i++)
        {
            v.push_back(timeSeries[i + 1] - timeSeries[i]);
        }
        int ret = duration;
        for (auto& e : v)
        {
            if (e >= duration)
            {
                ret += duration;
            }
            else
            {
                ret += e;
            }
        }
        return ret;
    }
};